import java.util.Scanner;

/**
 * Created by loso on 2017/3/30.
 */
public class _toutiao_2017330Test4 {
    public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
        while (in.hasNextInt()){
            int n = in.nextInt();
            int q = in.nextInt();

            int[] A = new int[n];
            for (int i = 0; i < n; i++) {
                A[i] = in.nextInt();
            }
            int[] B = new int[n];
            for (int i = 0; i < n; i++) {
                B[i] = in.nextInt();
            }
            int[][] Qnums = new int[q][];
            for (int i = 0; i < q; i++) {
                Qnums[i] = new int[2];
                Qnums[i][0] = in.nextInt();
                Qnums[i][1] = in.nextInt();
            }



            for (int i = 0; i < q; i++) {
                int count = 0;
                for (int j = 0; j < n; j++) {
                    if (Qnums[i][0] <= A[j] && Qnums[i][1] <= B[j]) {
                        ++count;
                    }
                }
                System.out.println(count);
            }
        }
    }

}
